{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="{% static 'plugins/bootstrap/css/bootstrap.css' %}">
    <style>
        .box{
            width: 400px;
            border: 1px solid #dddddd;
            margin-left: auto;
            margin-right: auto;
            margin-top: 100px;

            padding-right: 40px;
            padding-left: 40px;
            padding-bottom: 30px;

            box-shadow: 5px 10px 10px rgb(0 0 0 / 5%);
        }
    </style>
</head>
<body>
<div class="box">
    <h2 style="text-align: center">用户登录</h2>
        <form method="post" novalidate>
        {% csrf_token %}
            {% for field in form %}
            <div class="form-group" style="position: relative;margin-bottom: 25px;">
            <label>{{ field.label }}</label>
            {{ field }}
            <span style="color: red;position: absolute;">{{ field.errors.0 }}</span>
            </div>
            {% endfor %}

{#        {{ forms.non_field_errors.0 }}#}
{#            {{ forms.errors.username.0 }}#}
{#            {{ forms.errors.password.0 }}#}
{#        <div class="forms-group">#}
{#            <label>角色</label>#}
{#            <select class="forms-control" name="role">#}
{#                <option value="2">客户</option>#}
{#                <option value="1">管理员</option>#}
{#            </select>#}
{#            {{ forms.role }}#}
{#        </div>#}
{#        <div class="forms-group">#}
{#            <label>用户名</label>#}
{#            <input type="text" class="forms-control" placeholder="用户名" name="username"/>#}
{#            {{ forms.username }}#}
{#        </div>#}
{#        <div class="forms-group">#}
{#            <label>密码</label>#}
{#            <input type="text" class="forms-control" placeholder="密码" name="password"/>#}
{#            {{ forms.password }}#}
{#        </div>#}
        <button type="submit" class="btn btn-primary">登 录</button>
        <span style="color: red;">{{ error }}</span>

        <a href='{% url 'sms_login' %}' style="float: right;">短信登录</a>
    </form>

</div>

</body>
</html>